#pragma once

#include <map>
#include <array>

extern "C" {
typedef union SDL_Event SDL_Event;
typedef struct _SDL_GameController SDL_GameController;
}

class GamePadManager {
public:
    explicit GamePadManager(bool enableLog = false);
    virtual ~GamePadManager();
    void AddPlayStationClassicControllerSupport();
    bool processEvents(SDL_Event &e);
    virtual void onButton(int playerIndex, int button, bool pressed) {}
    virtual void onAxis(int playerIndex, int axis, float value) {}

private:
    bool doLog;
    std::map<int, SDL_GameController*> gamepads;
    std::map<int, std::array<bool, 15>> buttons;
    std::map<int, std::array<float, 6>> axes;
};

extern GamePadManager gGamePadManager;
